home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
programr
/
t-bcinfo.zip
/
TI640.ZIP
/
TI640.ASC
Wrap
Text File
|
1992-02-25
|
967b
|
67 lines
PRODUCT : C++ NUMBER : 640
VERSION : All
OS : PC DOS
DATE : February 25, 1992 PAGE : 1/1
TITLE : Precision and Decimal Places in iostreams
Given a real variable x (either float or double) with value 2.0
and also given a real variable PI = 3.1415926...
---- OUTPUT ---- ------------- STATEMENT ---------------
"x == 2" cout<<"x == "<<x;
"x==2.00" cout<<setprecision(3)
<<setiosflags(ios::showpoint)
<<"x == "<<x;
"x == "02.0" cout<<setw(4)<<setfill('0')
<<setprecision(2)
<<"x == "<<x;
"pi == 3.14" cout<<setprecision(3)<<"pi == "<<pi;
"pi == 3.1416" cout<<setprecision(5)<<"pi == "<<pi;